package com.davidk.survey.server.model.smartgwtrest;

import java.util.HashMap;
import java.util.List;

public class ErrorResponse extends Response {
	HashMap<String, Object> errors = new HashMap<String, Object>();
	private String data;
	
	public ErrorResponse(int status, String msg) {
		super.setStatus(status);
		this.setErrorMessage(msg);
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public void setErrorMessage(String msg) {
		this.data = msg;
	}

	public ErrorResponse() {
		super.setStatus(STATUS_VALIDATION_ERROR);
	}
	
	public HashMap<String, Object> getErrors() {
		return errors;
	}

	public void setErrors(HashMap<String, Object> errors) {
		this.errors = errors;
	}
	
	public void addError(String fieldName, String errorMsg){
		errors.put(fieldName, errorMsg);
	}
	
	public void addErrors(String fieldName, List<String> errorMsgs){
		errors.put(fieldName, errorMsgs);
	}
}
